/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dmitrygusev.web4konverta.mobile;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author dmitrygusev
 */
public class Application {

    private AppConfig appConfig;
    private String screenSize;
    private String platformName;
    private String version;

    public AppConfig getAppConfig() {
        return appConfig;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getVersion() {
        return version;
    }

    public String getPlatformName() {
        if (platformName == null) {
            platformName = System.getProperty("microedition.platform");
            if (platformName == null) {
                platformName = "Undefined";
            }
        }
        return platformName;
    }

    public String getScreenSize() {
        if (screenSize == null) {
            Canvas canvas = new Canvas() {
                protected void paint(Graphics g) {}
            };
            screenSize = canvas.getWidth() + "x" + canvas.getHeight();
        }
        return screenSize;
    }

    public void setAppConfig(AppConfig appConfig) {
        this.appConfig = appConfig;
    }

}
